package chapter13;

import chapter11.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @create 2018-04-17 下午2:17
 */
@Service
public class UserListServiceImpl implements UserListService {
    @Autowired
    private UserService userService;

    @Override
    @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
    public void addList(List<Role> roleList) {
        if (null != roleList) {
            roleList.forEach((role) -> userService.addUser(role));
        }
    }
}
